__author__ = 'shawhen'

import ctypes

from .. import Kernel32

from ..shared import minwindef as m_shared_minwindef


def CreatePipe(hReadPipe, hWritePipe, pipeAttributes, dwSize):
    """
    :param hReadPipe 管道读端 （不是指针）
    :param hWritePipe 管道写端（不是指针）
    :param pipeAttributes 管道属性结构体（不是指针）
    :param dwSize
    :return True/False
    """
    result = Kernel32.Kernel32_dll.CreatePipe(ctypes.byref(hReadPipe), ctypes.byref(hWritePipe), ctypes.byref(pipeAttributes), dwSize)
    if result == m_shared_minwindef.FALSE:
        result = False
    elif result == m_shared_minwindef.TRUE:
        result = True
    return result